package smashedapples.managers
{
	import flash.net.SharedObject;

	public class SharedObjectManager
	{
		public static function save( name:String, data:*, path:String = null, secure:Boolean = false ):void
		{
			var so:SharedObject = SharedObject.getLocal( name, path, secure );
			so.data[ "value" ] = data;
		}

		public static function getByName( name:String, defaultValue:* = null, path:String = null, secure:Boolean = false ):*
		{
			var so:SharedObject = SharedObject.getLocal( name, path, secure );

			if( so.data[ "value" ] == null )
				return defaultValue;

			return so.data[ "value" ];
		}



	}
}